package com.gurun.camera.addDevice;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;

import com.gurun.camera.BaseActivity;
import com.gurun.camera.addDevice.entity.DeviceInfoEntity;
import com.gurun.camera.addDevice.view.AddDeviceView;
import com.gurun.camera.addDevice.view.ISearchDevView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/12/23.
 */

public class SearchCameraDeviceActivity extends BaseActivity implements ISearchDevView, AddDeviceView {

//    @BindView(R.id.recyc_view)
//    RecyclerView mRecycView;
//
//    SearchCameraDeviceAdapter mAdapter;
//
//    private SearchDevPresenterImpl mSearchPresenter;
//
//    private List<DeviceInfoEntity> mDatas = new ArrayList<>();

    public static void startActivity(Context context) {
        Intent it = new Intent(context, SearchCameraDeviceActivity.class);
        context.startActivity(it);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_search_camera_device);
//        unbinder = ButterKnife.bind(this);
//        setTitleView(R.id.title_search_camera, getString(R.string.camera_search_device), false, Color.TRANSPARENT);
//        imgRight.setVisibility(View.GONE);
//        tvRight.setVisibility(View.VISIBLE);
//        tvRight.setText(R.string.common_help);
//        mSearchPresenter = new SearchDevPresenterImpl(this);
//        IAddDevicePresenter = new AddDevicePresenterImpl(this);
//        initViews();
//        startSearch();
    }

//    @Override
//    protected void onStop() {
//        super.onStop();
//        stopSearch();
//    }
//
//    private void initViews() {
//        LinearLayoutManager lm = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
//        mRecycView.setLayoutManager(lm);
//        mAdapter = new SearchCameraDeviceAdapter(this, mDatas, this);
//        mRecycView.setAdapter(mAdapter);
//    }
//
    void startSearch() {
//        mSearchPresenter.startSearchDevice();
    }

    void stopSearch() {
//        mSearchPresenter.stopSearchDevice();
    }

    @Override
    public void onSearchDeviceInfoResultBack(List<DeviceInfoEntity> list) {
//        mDatas.clear();
//        mDatas.addAll(list);
//        mAdapter.updateDataSrc(mDatas);
    }

    @Override
    public void onStartSearchingDevice() {

    }

    @Override
    public void onStopSearchingDevice() {

    }
//
//    //===================添加设备===================================
//    private IAddDevicePresenter IAddDevicePresenter;
//    private String mCurrentDeviceId = "";
//
    @Override
    public void onAddDevice(String deviceId) {
//        showProgressDialog();
//        mCurrentDeviceId = deviceId;
//        IAddDevicePresenter.checkDevStatus(deviceId);
    }
//
//    private void startDeviceEditPage() {
//        Intent it = new Intent(mContext, AddSmartDeviceActivity.class);
//        it.putExtra(Constant.INTENT_HARDWARE_ID, mCurrentDeviceId);
//        it.putExtra(Constant.DEVICE_TYPE, Constant.WIFI_CAMERA);
//        startActivity(it);
//        finish();
//    }
//
//    private void addFailed() {
//        hideProgressDialog();
//        ToastUtil.showShortToast("处理出现异常");
//    }
//
    @Override
    public void onAddDevSuccess() {
//        hideProgressDialog();
//        startDeviceEditPage();
    }

    @Override
    public void onAddDevFailed(String errorMsg) {
//        addFailed();
    }


    @Override
    public void onDeviceAddedByOther(String deviceId, String account) {
//        addFailed();
    }

    @Override
    public void onDeviceAddedByMyself() {
//        hideProgressDialog();
//        startDeviceEditPage();
    }

    @Override
    public void onDeviceOffline(String devId) {
//        addFailed();
    }

    @Override
    public void onDeviceCanAdd(String deviceId) {
//        IAddDevicePresenter.addDevice(deviceId, System.currentTimeMillis() + "");
    }

    @Override
    public void onDeviceIdIllegal(String result) {
//        addFailed();
    }

    @Override
    public void onDeviceStatusCheckFailed(String msg) {
//        addFailed();
    }
}
